package com.buydeem.composite;

/**
 *
 * @author zengchao
 * @date 2022-05-08 12:25:18
 */
public class Leaf extends Component{
    private Integer salary;

    public Leaf(String name, Integer salary) {
        super(name);
        this.salary = salary;
    }

    @Override
    public Integer getSalary() {
        return salary;
    }

    @Override
    public void print(Integer level) {
        for (int i = 0; i < level; i++) {
            System.out.print("-");
        }
        System.out.println(name + "(" + salary + ")");
    }
}
